package com.sufjan.service;

import com.spring.*;

@Component("userService")
@Scope("singleton")
public class UserService implements BeanNameAware,InitializingBean{

    private String name;
    public void setName(String name) {
        this.name = name;
    }
    public String getName() {
        return name;
    }

    //AutoWired
    @AutoWired
    private OrderService orderService;
    public void test(){
        System.out.println(orderService);
    }

    //BeanNameAware
    private String beanName;
    public String getBeanName() {
        return beanName;
    }
    @Override
    public void setBeanName(String name) {
        beanName=name;
    }

    //InitializingBean
    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("初始化后");
        System.out.println(name);
    }

}
